package com.bbs.util;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.oreilly.servlet.multipart.FileRenamePolicy;

public class RandomRename implements FileRenamePolicy {

	public File rename(File file) {
		String name = file.getName();
		String ext = name.substring(name.lastIndexOf("."));
		String newname = new SimpleDateFormat("yyyyMMddHHmmssms").format(new Date());
		newname = newname + ext;
		return new File(file.getParent(),newname);
	}

}
